<?php
class Act_frontliners extends CI_Controller {

	public function __construct()
	{
		parent::__construct();
		$this->load->model( 'moutlets' );
		$this->load->library('Enc');
	}
	
	public function getById( $id ) {
		if( isset( $id ) )
			echo json_encode( $this->moutlets->getFrontliners( $id ) );
	}
	
	public function read( $id ) {
		echo json_encode( $this->moutlets->getFrontliners( $this->enc->defog($id) ) );
	}
	
	public function delete( $id = null ) {
		if( is_null( $id ) ) {
			echo 'ERROR: Id not provided.';
			return;
		}
		$this->moutlets->deleteFrontliner( $id );
		//echo 'Records deleted successfully';
		
		$this->session->set_flashdata('message', 'Data Frontliner Berhasil dihapus');
		redirect(base_url()."index.php/master/outlets");
	}
}